package com.jrx.anytxn.customer.mapper.ext;

import com.jrx.anytxn.customer.entity.CmCustomerContactInfo;
import com.jrx.anytxn.customer.mapper.base.CmCustomerContactInfoMapper;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;
/**
 * 自定义 客户联系人mapper
 * @author Qingyao Xing
 * @date 2019/9/27 15:06
 */
public interface ExtCmCustomerContactInfoMapper extends CmCustomerContactInfoMapper {
    /**
     *  批量添加客户联系人
     * @param contacts  客户联系人对象list集合
     * @return int 添加成功个数
     * @author Qingyao Xing
     * @date 2019/9/27 15:01
     */
    int batchInsertSelective(@Param("list") List<CmCustomerContactInfo> contacts);

    /**
     * 修改客户联系人
     * @param cond
     * @return
     */
    int updateByCondSelective(CmCustomerContactInfo cond);
    /**
     *  获取客户联系人集合
     * @param cond 客户联系人 查询的条件对象
     * @return java.util.List<com.jrx.anytxn.customer.entity.CmCustomerContactInfo> 返回的客户联系人数据集合
     * @author Qingyao Xing
     * @date 2019/9/27 15:04
     */
    List<CmCustomerContactInfo> selectByCondSelective(@Param("cond") CmCustomerContactInfo cond);


    /**
     * 根据客户编号 租户编号 查询
     * @param tenantId
     * @param customerId
     * @return
     */
    List<CmCustomerContactInfo> selectByTenantIdAndCustomerId(@Param("tenantId") String tenantId,@Param("customerId") String customerId);

    /**
     * 统计客户联系人信息的数量
     *
     * @return int
     */
    int selectCountForBatch();

    void batchInsert(List<CmCustomerContactInfo> list);

    CmCustomerContactInfo selectByCustomerIdAndRelationship(@Param("customerId") String customerId,@Param("relationship") String relationship);

    List<CmCustomerContactInfo> selectByUpdateTime(@Param("startTime") Date startTime);

    /**
     * 根据客户编号，租户id，更新时间查询
     *
     * @param tenantId
     * @param customerId
     * @param updateTime
     * @param channels
     * @param relationships
     * @return
     */
    List<CmCustomerContactInfo> selectByCustomerIdAndUpdateTime(@Param("tenantId") String tenantId,@Param("customerId") String customerId, @Param("updateTime") Date updateTime, @Param("channels") List<String> channels, @Param("relationships") List<String> relationships);
}
